package com.gitee.jisong.supercore.config

import org.springframework.context.annotation.Bean
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
import org.springframework.security.core.userdetails.User
import org.springframework.security.core.userdetails.UserDetailsService
import org.springframework.security.provisioning.InMemoryUserDetailsManager
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer


@EnableWebSecurity
open class WebSecurityConfig : WebMvcConfigurer {


    @Bean
    open fun userDetailsService(): UserDetailsService {
        val manager = InMemoryUserDetailsManager()
        manager.createUser(User.withDefaultPasswordEncoder()
                .username("user")
                .password("password").roles("USER").build())
        return manager
    }
}